<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #box {
            display: flex;
            border: 3px solid #ddd;
            width: 50%;
            height: 500px;
            margin: 50px auto;
            /* 默认不换行 压缩每个元素的大小 */
            /* flex-direction: row;
            flex-wrap: wrap; */
            /* flex-d && flex -w 结合 */
            /* flex-flow: row wrap;
            justify-content: center;
            align-items: baseline; */
            /*根据第一个元素的基线对其*/
            flex-flow: column;
            align-items: center;
            justify-content: center;

        }

        #box div {
            /* flex: 1; */
            width: 100px;
            height: 100px;
            background-clip: content-box;
            box-sizing: border-box;
            background-color: green;
            border: 1px solid #ddd;
            padding: 15px;
            color: #fff;
        }

        #box div:first-child {
            padding: 25px;
        }

        #box div:nth-child(3),
        div:nth-child(7) {
            /* order: 5; */
            align-self: flex-end;
        }

        #box div:nth-child(1),
        div:nth-child(5) {
            align-self: flex-start;
        }
    </style>
</head>

<body>
    <div id="box">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
    </div>
</body>

</html>